package com.qjc.demo.controller;

import com.qjc.demo.service.HelloProvider;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class HelloController {

    @Reference
    HelloProvider helloProvider;

    @GetMapping(value = "/api/hello")
    @ResponseBody
    public String index(@RequestParam("name") String name) {
        return helloProvider.hello(name);
    }

    @GetMapping(value = "/api/testMapList")
    @ResponseBody
    public List<Map<String, String>> testMapList() {
        Map<String, String> map = new HashMap<String, String>();
        map.put("hello", "nacos-dubbo");
        return helloProvider.testMapList(map);
    }

}
